home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d27
/
matenc.arc
/
CPP1580.CLP
< prev
next >
Wrap
Text File
|
1991-12-04
|
4KB
|
88 lines
CPP1580: PGM PARM(&PGM &FILE &MBR &REPLACE &AUT)
/* Program - CPP1580 */
/* CPP for command ENCPGM */
/* Encapsulate program from database file. */
DCL &PGM *CHAR 20 /* Program.Library name */
DCL &FILE *CHAR 20 /* File.Library name */
DCL &MBR *CHAR 10 /* Member name */
DCL &REPLACE *CHAR 01 /* Program option */
DCL &AUT *CHAR 01 /* Keep same authority */
DCL &NEWLIB *CHAR 10 /* New library name */
DCL &P *CHAR 10 /* Program name */
DCL &PL *CHAR 10 /* Program's library */
DCL &F *CHAR 10 /* File name */
DCL &FL *CHAR 10 /* File's library */
DCL &OBJEXIST *CHAR 01
DCL &TIME *CHAR 006
DCL &CNT *DEC 003
DCL &MSGID *CHAR 007
DCL &MSGDTA *CHAR 132
MONMSG MSGID(CPF0000) EXEC(GOTO RCVMSG)
RTVSYSVAL: RTVSYSVAL SYSVAL(QTIME) RTNVAR(&TIME)
CHGVAR VAR(&F) VALUE(%SST(&FILE 01 10))
CHGVAR VAR(&FL) VALUE(%SST(&FILE 11 10))
CHGVAR VAR(&P) VALUE(%SST(&PGM 01 10))
CHGVAR VAR(&PL) VALUE(%SST(&PGM 11 10))
CHKOBJ OBJ(%SST(&PGM 01 10).%SST(&PGM 11 10)) +
OBJTYPE(*PGM)
MONMSG MSGID(CPF9810) EXEC(GOTO RCVMSG)
MONMSG MSGID(CPF9801) EXEC(DO)
RCVMSG
IF (&AUT *EQ '1') DO
SNDPGMMSG MSG('Program ' *CAT %SST(&PGM 01 10) *TCAT +
'.' *CAT %SST(&PGM 11 10) *BCAT 'doesn''t +
exist. GRTOBJAUT failed') MSGTYPE(*DIAG)
CHGVAR VAR(&AUT) VALUE('0')
ENDDO
CHGVAR VAR(&OBJEXIST) VALUE('0')
GOTO REPLACE
ENDDO
DUPLICATE: IF (&REPLACE *EQ '0') DO
SNDPGMMSG MSG('Program ' *CAT %SST(&PGM 01 10) *TCAT +
'.' *CAT %SST(&PGM 11 10) *BCAT 'already +
exists.') MSGTYPE(*DIAG)
RETURN
ENDDO
CHGVAR VAR(&OBJEXIST) VALUE('1')
REPLACE: IF ((&REPLACE *EQ '1') *AND (&OBJEXIST *EQ '1')) DO
CHGVAR VAR(&NEWLIB) VALUE('Q38' *CAT &TIME)
CRTLIB LIB(&NEWLIB) TEXT('Library created by ENCPGM +
at' *BCAT &TIME)
MONMSG MSGID(CPF2111)
CRTPGM: CALL PGM(QSCCRTPG) PARM(&P &NEWLIB &F &FL &MBR)
GRTLIKE: IF (&AUT *EQ '1') DO
GRTOBJAUT OBJ(&P.&NEWLIB) OBJTYPE(*PGM) REFOBJ(&P.&PL)
ENDDO
RNMOBJ OBJ(&P.&PL) OBJTYPE(*PGM) NEWOBJ(&NEWLIB)
MOVOBJ OBJ(&P.&NEWLIB) OBJTYPE(*PGM) TOLIB(&PL)
DLTPGM PGM(&NEWLIB.&PL)
DLTLIB LIB(&NEWLIB)
ENDDO
ELSE DO
ENCPGM: CALL PGM(QSCCRTPG) PARM(&P &PL &F &FL &MBR)
ENDDO
RCVMSG: /* Receive and forward program messages. */
RCVMSG RMV(*YES) MSGDTA(&MSGDTA) MSGID(&MSGID)
IF (&MSGID *EQ ' ') RETURN
IF (%SST(&MSGID 1 2) *EQ 'CP' +
*OR %SST(&MSGID 1 3) *EQ 'MCH') DO
IF (&MSGDTA *EQ ' ') SNDPGMMSG MSGID(&MSGID) +
MSGF(QCPFMSG) TOPGMQ(*PRV) MSGTYPE(*DIAG)
ELSE SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) +
MSGDTA(&MSGDTA) TOPGMQ(*PRV) MSGTYPE(*DIAG)
CHGVAR VAR(&CNT) VALUE(&CNT + 1)
IF ((&CNT *GT 0) *AND (&CNT *LT 10)) GOTO RCVMSG
/* MAXMSG(10) */
ENDDO
ENDPGM: ENDPGM